<div class="page-header">
    <h1>Index of blog</h1>
</div>

<% form_for(blog, {action: '/blogs', method: 'POST', id: "blog_form", class: 'form-horizontal'}, function (form) { %>
    <%- errorMessagesFor(blog) %>
<div class="control-group">
   <%- form.label("微博", false, {class: "control-label"}) %>
   <div class="controls">
       <%- form.textarea("content") %>
   </div>
</div>
    <div class="form-actions">
        <%- form.submit('<i class="icon-ok icon-white"></i> Create blog', {class: 'btn btn-primary'}) %> or
        <%- link_to('Cancel', '/blogs', {class: 'btn'}) %>
    </div>
<% });%>

<div class="row">
    <div class="span12">
        <% if (blogs.length > 0) { %>
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <% blogs.forEach(function (blog) { %>
                        <tr>
                            <td><strong><%- link_to('blog #' + blog.id, path_to.blog(blog)) %>  内容：  <%- blog.content %></strong><%- path_to.blog(blog) %> </td>
                            <td>
                                <%- link_to('<i class="icon-edit"></i> Edit', path_to.edit_blog(blog), {class: 'btn btn-mini'}) %><%- path_to.edit_blog(blog) %> 
                                <%- link_to('<i class="icon-remove icon-white"></i> Delete', path_to.blog(blog), {class: 'btn btn-mini btn-danger', method: 'delete', remote: true, jsonp: '(function (u) {location.href = u;})'}) %>        
                            </td>
                        </tr>
                    <% }); %>        
                </tbody>
            </table>
        <% } else { %>
            <p class="alert alert-block alert-info">
                <strong>No blogs were found.</strong> 
            </p>
        <% } %>
    </div>
</div>